home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / comm / misc / xqsrc1_7.lzh / include / xferq.h < prev    next >
C/C++ Source or Header  |  1993-03-13  |  12KB  |  353 lines

  1. /*
  2.  *    Name:                xferq.h
  3.  *
  4.  * Description:    Public include file for xferq.library
  5.  *
  6.  * Copyright:        1992-1993 by David Jones.
  7.  *
  8.  * Distribution:
  9.  *        This source file is released with no restrictions in its use
  10.  *        whatsoever, provided that it is included free of charge in the
  11.  *        source and binary distributions of xferq.library.
  12.  *
  13.  *        In particular, you may use this file to interface to xferq.library
  14.  *        without subjecting your application to the terms and conditions of
  15.  *        the GNU General Public License or the General Library Public License.
  16.  *        The intent is to prevent the fact that xferq.library is copylefted
  17.  *        from being a deterrent to its use by non-copylefted programs.
  18.  *
  19.  *        Please note that this distribution notice applies only to those
  20.  *        source files having this notice at the top of the file.  All other
  21.  *        source files are subject to the terms and conditions of the
  22.  *        General Public License.
  23.  *
  24.  *        This program is distributed in the hope that it will be useful,
  25.  *        but WITHOUT ANY WARRANTY; without even the implied warranty of
  26.  *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  27.  *        GNU General Public License for more details.
  28.  *
  29.  *        You should have received a copy of the GNU General Public License
  30.  *        along with this program; if not, write to:
  31.  *
  32.  *                The Free Software Foundation        David Jones
  33.  *                675 Mass Ave                            6730 Tooney Drive
  34.  *                Cambridge, MA                            Orleans, Ontario
  35.  *                02139                                        K1C 6R4
  36.  *                USA                                        Canada
  37.  *
  38.  *    Usenet:    gnu@prep.ai.mit.edu                    aa457@freenet.carleton.ca
  39.  *    Fidonet:                                                1:163/109.8
  40.  *
  41.  */
  42.  
  43. #ifndef XFERQ_H
  44. #define XFERQ_H
  45.  
  46. #ifndef EXEC_TYPES_H
  47. #include <exec/types.h>
  48. #endif
  49.  
  50. #ifndef EXEC_LISTS_H
  51. #include <exec/lists.h>
  52. #endif
  53.  
  54. #ifndef EXEC_NODES_H
  55. #include <exec/nodes.h>
  56. #endif
  57.  
  58. #define    USE_PRIVATE_POOL
  59. #ifndef USE_PRIVATE_POOL
  60. #ifndef EXEC_MEMORY_H
  61. #include <exec/memory.h>
  62. #endif
  63. #endif
  64.  
  65. #ifndef UTILITY_TAGITEM_H
  66. #include <utility/tagitem.h>
  67. #endif
  68.  
  69. extern struct Library *XferqBase;
  70.  
  71.  
  72. /*
  73. *    Defines for XfqAnyWork()
  74. */
  75.  
  76. #define    NO_WORK            0    /* No work at all */
  77. #define    LOCKED_WORK        1    /* There's work, but someone locked it */
  78. #define    UNLOCKED_WORK    2    /* There's unlocked work */
  79. #define    PENDING_WORK    3    /* No work, but a packer's busy making some */
  80.  
  81. /*
  82. *    Return codes for XfqRemoveWork()
  83. */
  84.  
  85. #define    XQRM_UNSENT        0    /* File's status was not XQ_SENT -> no op */
  86. #define    XQRM_SENT        1    /* File was sent, nothing else */
  87. #define    XQRM_DELETED    1    /* File was deleted */
  88. #define    XQRM_TRUNCATED    2    /* File was truncated */
  89. #define    XQRM_ERROR        3    /* Something nasty happened */
  90.  
  91. /*
  92. *    User flags
  93. */
  94.  
  95. #define    XQ_DELETE        1            /* Delete file after sending */
  96. #define    XQ_TRUNCATE        2            /* Truncate file after sending */
  97. #define    XQ_IMMEDIATE    4            /* Send only if session currently up */
  98. #define    XQ_SENDLATER    8            /* Make eligible after session goes down */
  99.  
  100. /*
  101. *    Status
  102. */
  103.  
  104. #define    XQ_UNSENT        0            /* Node has not been sent */
  105. #define    XQ_SENT            1            /* Node has been sent */
  106. #define    XQ_INTRANSIT    2            /* File is being sent */
  107. /* The following are taken from flow.library/work_detail.h */
  108. #define    XQ_HUNGUP        3            /* Remote end hung up on us */
  109. #define    XQ_RETRIES        4
  110. #define    XQ_ABORT            5
  111. #define    XQ_REFUSED        6
  112. #define    XQ_PRIREJ        7
  113. #define    XQ_NOTFOUND        8
  114.  
  115. /*
  116. *    Priority
  117. */
  118.  
  119. #define    XQ_MINPRI        -127        /* smallest tx priority */
  120. #define    XQ_MAXPRI        127        /* highest tx priority */
  121. #define    XQ_NOPRI            -128        /* special value: no nodes in list */
  122.  
  123. #define    XQSESS_PRIVATE        1    /* This is a private session */
  124.  
  125. /*
  126. *    Network types
  127. */
  128.  
  129. #define    XQNT_FIDO        'FIDO'
  130. #define    XQNT_FQDA        'FQDA'
  131. #define    XQNT_UUCP        'UUCP'
  132. #define  XQNT_TEXT      'TEXT'
  133.  
  134.  
  135. /*
  136. *    Object types
  137. */
  138.  
  139. #define    XQO_NULL                0
  140. #define    XQO_ADDRESS            1
  141. #define    XQO_ARRAY            2
  142. #define    XQO_STRING            3
  143. #define    XQO_SESSION            4
  144. #define    XQO_WORKNODE        5
  145.  
  146. /*
  147. *    Flags for address I/O
  148. */
  149.  
  150. #define    XQADDR_USERNAME    1
  151. #define    XQADDR_DOMAIN        2
  152. #define    XQADDR_ZONE            4
  153. #define    XQADDR_NET            8
  154. #define    XQADDR_NODE            16
  155. #define    XQADDR_POINT        32
  156. #define    XQADDR_MACHINE        64
  157. #define    XQADDR_FQDA            128
  158. #define    XQADDR_2D            (XQADDR_NET | XQADDR_NODE)
  159. #define    XQADDR_3D            (XQADDR_2D | XQADDR_ZONE)
  160. #define    XQADDR_4D            (XQADDR_3D | XQADDR_POINT)
  161. #define    XQADDR_FIDO            (XQADDR_4D | XQADDR_DOMAIN)
  162. #define    XQADDR_TEXT            256
  163. #define    XQADDR_ANYTHING    511
  164. #define    XQADDR_ALLBUTUSER    (XQADDR_ANYTHING & ~XQADDR_USERNAME)
  165.  
  166. #define    XQADDR_ATDOMAIN    1024    /* PutAddress only */
  167. #define    XQADDR_DELTA        2048    /* PutAddress only */
  168.  
  169. /*
  170. *    Tags for all functions
  171. */
  172.  
  173. #define    XQ_BASE            0x8000FC00
  174. #define    XQ_OBASE            (XQ_BASE + 0x80)    /* Start of object values */
  175.  
  176. /* Work nodes */
  177. #define    XQ_Name            (XQ_OBASE + 0)        /* Filename */
  178. #define    XQ_AsName        (XQ_OBASE + 1)        /* Asname */
  179. #define    XQ_Pri            (XQ_OBASE + 2)        /* Priority */
  180. #define    XQ_Flags            (XQ_OBASE + 3)        /* File management flags */
  181. #define    XQ_Status        (XQ_OBASE + 4)        /* File status */
  182. #define    XQ_Site            (XQ_OBASE + 5)        /* Site */
  183.  
  184. /* Addresses */
  185. #define    XQ_Network        (XQ_OBASE + 16)    /* 'FIDO', 'FQDA', 'INET', etc */
  186. #define    XQ_ZoneStr       (XQ_OBASE + 17)    /* Fidonet zone */
  187. #define    XQ_NetStr       (XQ_OBASE + 18)    /* Fidonet net */
  188. #define    XQ_NodeStr       (XQ_OBASE + 19)    /* Fidonet node */
  189. #define    XQ_PointStr        (XQ_OBASE + 20)    /* Fidonet point */
  190. #define    XQ_Domain       (XQ_OBASE + 21)   /* Fidonet domain */
  191. #define    XQ_UserName        (XQ_OBASE + 22)    /* Network user name */
  192. #define    XQ_UucpName        (XQ_OBASE + 23)   /* UUCP address */
  193. #define    XQ_Zone            (XQ_OBASE + 24)
  194. #define    XQ_Net            (XQ_OBASE + 25)
  195. #define    XQ_Node            (XQ_OBASE + 26)
  196. #define    XQ_Point            (XQ_OBASE + 27)
  197. #define    XQ_FqdaName        (XQ_OBASE + 28)    /* FQDA name */
  198. #define    XQ_TextName        (XQ_OBASE + 29)    /* Text address */
  199.  
  200. /* Sessions/nodes */
  201. #define    XQ_SessFlags    (XQ_OBASE + 32)    /* Session flags */
  202.  
  203. /* Array/string */
  204. #define    XQ_Size            (XQ_OBASE + 48)    /* Object size */
  205.  
  206. /* Other */
  207. #define    XQ_ErrorCode    (XQ_BASE + 1)        /* Extended error codes */
  208. #define    XQ_ErrorMsg        (XQ_BASE + 2)        /* Extended error message */
  209. #define    XQ_IncLocked    (XQ_BASE + 3)        /* Include locked items */
  210. #define    XQ_AddHead        (XQ_BASE + 4)        /* Add item at head */
  211. #define    XQ_AddTail        (XQ_BASE + 5)        /* Add item at tail */
  212. #define    XQ_AddSorted    (XQ_BASE + 6)        /* Add item in sorted position */
  213. #define    XQ_AddGlobal    (XQ_BASE + 7)        /* Add item to global session */
  214. #define    XQ_Reverse        (XQ_BASE + 8)        /* Walk session in reverse dir */
  215. #define    XQ_MapForward    (XQ_BASE + 9)        /* Map in forward direction */
  216. #define    XQ_MapReverse    (XQ_BASE + 10)        /* Map in reverse direction */
  217. #define    XQ_Filter        (XQ_BASE + 11)        /* Apply a filter */
  218. #define    XQ_CallBack        (XQ_BASE + 12)        /* Callback function */
  219. #define    XQ_NoCopyStrs    (XQ_BASE + 13)        /* Don't copy string data */
  220. #define    XQ_EndPos        (XQ_BASE + 14)        /* End position for parse */
  221. #define    XQ_Mandatory    (XQ_BASE + 15)        /* Mandatory fields */
  222. #define    XQ_Optional        (XQ_BASE + 16)        /* Optional fields */
  223. #define    XQ_LineSize        (XQ_BASE + 17)        /* Length of line */
  224. #define    XQ_Delta            (XQ_BASE + 18)        /* Output address diffs */
  225. #define    XQ_Inclusive    (XQ_BASE + 19)        /* All must match */
  226. #define    XQ_SpaceDelim    (XQ_BASE + 20)        /* Space is allowable in addr */
  227. #define    XQ_SessOnly        (XQ_BASE + 21)        /* Only report nodes w/sessions */
  228. #define    XQ_MinPri        (XQ_BASE + 22)        /* Minimum priority */
  229. #define    XQ_MaxPri        (XQ_BASE + 23)        /* Maximum priority */
  230.  
  231.  
  232. /*
  233. *    Extended error codes.  If you pass in XQ_ErrorCode followed by a
  234. *    long pointer, the longword will be filled in with one of the
  235. *    following:
  236. */
  237.  
  238. #define    XQERROR_OK            0    /* no error */
  239. #define    XQERROR_NOMEM        1    /* out of memory */
  240. #define    XQERROR_DOS            2    /* AmigaDOS error - use IoErr() */
  241. #define    XQERROR_ENDQUEUE    3    /* End of queue reached for XfqScanWork */
  242. #define    XQERROR_NOTAG        4    /* Required value is missing */
  243. #define    XQERROR_LOCKED        5    /* Requested node is locked */
  244. #define    XQERROR_NOEXIST    6    /* Node does not exist */
  245. #define    XQERROR_BADADR        7    /* Illegal address specification */
  246. #define    XQERROR_NOSESSION    8    /* No session for XQ_IMMEDIATE */
  247. #define    XQERROR_BADOBJECT    9    /* Illegal object for function call */
  248. #define    XQERROR_QUEUED        10    /* Work is already queued to site */
  249. #define    XQERROR_MAX            10
  250.  
  251. /*
  252. *    We really shouldn't need this but SAS/C 6.2 barfs.
  253. *    Commodore could look into this:
  254. *    ULONG (*func)() != ULONG (*func)(register __ etc) due to assumption
  255. *        of stack conventions when arguments are not given.
  256. */
  257.  
  258. typedef ULONG (*HOOK_FUNC)();
  259.  
  260. /*
  261. *    Prototypes
  262. */
  263.  
  264. ULONG XfqAddWork(struct NetAddress *, struct WorkNode *);
  265. ULONG XfqAddWorkQuick(char *, char *, char *, LONG, LONG);
  266. ULONG XfqAnyWork(void *, struct TagItem *);
  267. struct WorkNode *XfqGetWork(void *, struct TagItem *);
  268. struct WorkNode *XfqFindWork(struct TagItem *);
  269. void XfqUnlockWork(struct WorkNode *);
  270. ULONG XfqRemoveWork(struct WorkNode *);
  271. LONG XfqMaxSitePri(void *);
  272. void XfqWalkQueueCallBack(struct NetAddress *, struct TagItem *);
  273. struct Session *XfqGetSiteList(void);
  274. void XfqFlushQueue(void *object);
  275.  
  276. ULONG XfqBeginSession(struct Session *, struct TagItem *);
  277. void XfqEndSession(struct Session *, void *);
  278. ULONG XfqSessionUp(struct NetAddress *);
  279. void XfqSortSession(struct Session *, struct TagItem *);
  280. void XfqWalkSessionCallBack(struct Session *, struct TagItem *);
  281.  
  282. ULONG XfqNextSeq(void);
  283. void *XfqHook(struct TagItem *);
  284.  
  285. struct NetAddress *XfqGetAddress(char *, struct NetAddress *, struct TagItem *);
  286. char *XfqPutAddress(void *, struct TagItem *);
  287. LONG XfqCmpAddress(void *, void *, struct TagItem *);
  288. struct NetAddress *XfqMap(struct NetAddress *, struct TagItem *);
  289. ULONG XfqFilter(void *, struct TagItem *);
  290.  
  291. LONG XfqGetError(void);
  292. char *XfqErrorMsg(LONG);
  293.  
  294. void *XfqCreateObject(ULONG, struct TagItem *);
  295. void XfqDropObject(void *);
  296. void XfqExamObject(void *, struct TagItem *);
  297. void *XfqModifyObject(void *, struct TagItem *);
  298. void *XfqCopyObject(void *);
  299.  
  300. ULONG XfqHoldMailer(struct NetAddress *);
  301. ULONG XfqReleaseMailer(struct NetAddress *);
  302.  
  303. /*
  304. *    Varargs prototypes
  305. */
  306.  
  307. struct WorkNode *XfqFindWorkTags(Tag, ...);
  308. void XfqWalkQueueCallBackTags(struct NetAddress *, Tag, ...);
  309. struct WorkNode *XfqGetWorkTags(void *, Tag, ...);
  310. ULONG XfqAnyWorkTags(void *, Tag, ...);
  311.  
  312. ULONG XfqBeginSessionTags(struct Session *, Tag, ...);
  313. void XfqSortSessionTags(struct Session *, Tag, ...);
  314. void XfqWalkSessionCallBackTags(struct Session *, Tag, ...);
  315. void *XfqHookTags(Tag, ...);
  316.  
  317. struct NetAddress *XfqGetAddressTags(char *, struct NetAddress *, Tag, ...);
  318. char *XfqPutAddressTags(void *, Tag, ...);
  319. LONG XfqCmpAddressTags(void *, void *, Tag, ...);
  320. struct NetAddress *XfqMapTags(struct NetAddress *, Tag, ...);
  321. ULONG XfqFilterTags(void *, Tag, ...);
  322.  
  323. void *XfqCreateObjectTags(ULONG, Tag, ...);
  324. void XfqExamObjectTags(void *, Tag, ...);
  325. void *XfqModifyObjectTags(void *, Tag, ...);
  326.  
  327. #ifdef __SASC_60
  328. /*
  329.  *        The following lines define the tag interface and eliminate need
  330.  *        for xferqglue.c.  SAS/C 6.0 required!!!
  331.  */
  332. #pragma tagcall XferqBase XfqHookTags 24 801
  333. #pragma tagcall XferqBase XfqFindWorkTags 4E 801
  334. #pragma tagcall XferqBase XfqWalkQueueCallBackTags 66 9802
  335. #pragma tagcall XferqBase XfqBeginSessionTags 78 9802
  336. #pragma tagcall XferqBase XfqSortSessionTags 8A 9802
  337. #pragma tagcall XferqBase XfqWalkSessionCallBackTags 90 9802
  338. #pragma tagcall XferqBase XfqGetAddressTags 9C A9803
  339. #pragma tagcall XferqBase XfqPutAddressTags A2 9802
  340. #pragma tagcall XferqBase XfqCmpAddressTags A8 A9803
  341. #pragma tagcall XferqBase XfqMapTags AE 9802
  342. #pragma tagcall XferqBase XfqFilterTags B4 9802
  343. #pragma tagcall XferqBase XfqCreateObjectTags C6 8002
  344. #pragma tagcall XferqBase XfqExamObjectTags D2 9802
  345. #pragma tagcall XferqBase XfqModifyObjectTags D8 9802
  346. #pragma tagcall XferqBase XfqAnyWorkTags 42 9802
  347. #pragma tagcall XferqBase XfqGetWorkTags 48 9802
  348. #pragma tagcall XferqBase XfqMaxSitePriTags 60 9802
  349. #endif
  350.  
  351.  
  352. #endif /* XFERQ_H */
  353.